package com.ccp.dev.system.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ccp.dev.core.basic.annotion.Action;
import com.ccp.dev.core.basic.consts.UrlConstants;
import com.ccp.dev.core.basic.response.ResultData;
import com.ccp.dev.core.util.CollectionUtil;
import com.ccp.dev.system.model.IndexLayoutManage;
import com.ccp.dev.system.service.IndexLayoutManageService;

@Controller
@RequestMapping(UrlConstants.PROJECT_ROOT+UrlConstants.PROJECT_MODULE_SYSTEM+"/index")
public class IndexController {
	@Autowired
    private IndexLayoutManageService indexLayoutManageService;
	/**
     * 获取首页内容
     * @return
     */
	@GetMapping("/indexContent")
	@ResponseBody
	@Action(description="获取首页内容",exectype = "查询日志")
    public ResultData indexContent() {		
		IndexLayoutManage indexLayoutManage = new IndexLayoutManage();
		indexLayoutManage.setIsDef(1);
		List<IndexLayoutManage> list = indexLayoutManageService.selectIndexLayoutManageList(indexLayoutManage);
		if (CollectionUtil.isEmpty(list)) {
			return ResultData.success("无首页内容", "无首页内容");
		}
		return ResultData.success("首页内容", list.get(0).getDesignHtml());
	}
}
